package junyi.power.effects;

import junyi.player.Player;
import junyi.player.PlayerProperty;

/**
 * User: Junyi BEI
 * Date: 12-9-30
 * Time: 下午2:33
 */
public final class PropertyChange<T> extends Effect {
  
  private Player player;
  private T value;
  private Class<? extends PlayerProperty<T>> playerProperty;


  public PropertyChange(Player p, Class<? extends PlayerProperty<T>> pp, T v, EffectSource es) {
    super(es);
    player = p;
    playerProperty = pp;
    value = v;
  }

  @Override
  public int start() {
    return player.getPlayerProperty(playerProperty).change(value);
  }

  public Player getPlayer() {
    return player;
  }

  public void setPlayer(Player player) {
    this.player = player;
  }

  public Class<? extends PlayerProperty> getPlayerProperty() {
    return playerProperty;
  }

  public void setPlayerProperty(Class<? extends PlayerProperty> playerProperty) {
    this.playerProperty = playerProperty;
  }
}
